package com.hut.oa.model.bean;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.springframework.format.annotation.DateTimeFormat;
@Entity
@Table(name="discuss_active")
public class DiscussActive {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="a_id")
	private Long id;
	
	@Column(name="a_address",nullable=false)
	private String address;//活动地址
	
	@Temporal(TemporalType.DATE)
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@Column(name="a_start_time",nullable=false)
	private Date startTime;//活动开始时间
	
	@Temporal(TemporalType.DATE)
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@Column(name="a_end_time",nullable=false)
	private Date endTime;//活动结束时间
	
	@JoinColumn(name="da_id")
	@OneToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY)
	private DiscussArea discuss;//帖子
	
	public DiscussActive() {}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public DiscussArea getDiscuss() {
		return discuss;
	}
	public void setDiscuss(DiscussArea discuss) {
		this.discuss = discuss;
	}
	
	@Override
	public String toString() {
		return "Active [id=" + id + ", address=" + address + ", startTime=" + startTime + ", endTime=" + endTime
				+  "]";
	}

}
